package common.util;

import java.io.FileInputStream;
import java.io.FileOutputStream;

import board.model.BoardFile;

public class FormFileSave {
	
	public static String save(String save_path, BoardFile boardFile) throws Exception{
		
		FileInputStream inputStream = new FileInputStream(boardFile.getAttach());
		FileOutputStream outputStream = new FileOutputStream(save_path + "/" + boardFile.getAttachFileName());
		 System.out.println("boardFile.getAttachFileName() : " + boardFile.getSaveFileName());
		int byteRead = 0;
		byte[] buffer = new byte[1024];
		 
		while((byteRead = inputStream.read(buffer, 0, 1024)) != -1)
			outputStream.write(buffer, 0, byteRead);
		 
		outputStream.close();
		inputStream.close();
		return "";
	}
}
